package com.jdls.dao;

import com.jdls.pojo.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author 嘉德罗斯
 * @date 2021/9/16
 */
public interface BookDao {

    @Insert("INSERT INTO book VALUES(null,#{type},#{name},#{description})")
    public boolean add(Book book);
    @Update("update book set type = #{type},name = #{name},description = #{description} where id = #{id}")
    public boolean update(Book book);
    @Delete("DELETE FROM book WHERE id = #{id}")
    public boolean delete(int id);
    @Select("SELECT * FROM book")
    public Book findById(int id);
    @Select("SELECT * FROM book where id = #{id}")
    public List<Book> FindAll();
}
